/* GUI CONVERTED from rsrp02.p (converter v1.76) Thu Feb 28 19:34:14 2002 */
/* rsrp02.p - Release Management Supplier Schedules                           */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.17 $                                                          */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 7.0    LAST MODIFIED: 01/29/92         BY: WUG *F110*            */
/* REVISION: 7.0    LAST MODIFIED: 01/29/92         BY: WUG *F312*            */
/* REVISION: 7.0    LAST MODIFIED: 03/26/92         BY: WUG *F323*            */
/* REVISION: 7.0    LAST MODIFIED: 09/17/92         BY: WUG *G152*            */
/* REVISION: 7.3    LAST MODIFIED: 10/13/92         BY: WUG *G462*            */
/* REVISION: 7.5    LAST MODIFIED: 03/16/95         BY: dpm *J044*            */
/* REVISION: 7.3    LAST MODIFIED: 10/22/95         BY: vrn *G0YF*            */
/* REVISION: 7.3    LAST MODIFIED: 02/22/96         BY: kjm *G1NR*            */
/* REVISION: 8.5    LAST MODIFIED: 05/07/96         BY: taf *J0LG*            */
/* REVISION: 8.5    LAST MODIFIED: 03/04/97         BY: WUG *J1K3*            */
/* REVISION: 8.6    LAST MODIFIED: 05/20/98         BY: *K1Q4* Alfred Tan     */
/* REVISION: 8.6E   LAST MODIFIED: 08/19/98         BY: *L062* Steve Nugent   */
/* REVISION: 9.0    LAST MODIFIED: 12/01/98         BY: *K1QY* Pat McCormick  */
/* REVISION: 9.0    LAST MODIFIED: 03/13/99         BY: *M0BD* Alfred Tan     */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane     */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown           */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.17 $   BY: Jean Miller           DATE: 02/28/02  ECO: *N1BB*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

/* SCHEDULE COMPARE */
define new shared variable impexp_label as character format "x(8)" no-undo.
define new shared variable global_schtype as integer.

define new shared buffer schmstr1 for sch_mstr.
define new shared buffer schmstr2 for sch_mstr.

define variable schtype like sch_type initial 4.
define variable sch_type_desc as character format "x(24)" no-undo.
define variable sch_type_numonic as character format "x(8)" no-undo.
define variable use_ship_sched like mfc_logical no-undo.
define variable schrlse_1 like sch_rlse_id.
define variable schrlse_2 like sch_rlse_id.
define variable impexp   like mfc_logical no-undo.
define variable subtype as character format "x(12)"
   label "Subcontract Type" no-undo.

{rsordfrm.i}


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   skip(1)
   schtype              colon 18
   space (3) sch_type_desc no-label
   schrlse_1            colon 18
   schrlse_2            colon 18
with frame a width 80 THREE-D /*GUI*/.

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

/* CHECK FLAG TO SEE IF MODULE IS TURNED ON */
if can-find (first mfc_ctrl where
                   mfc_field = "enable_shipping_schedules"
               and mfc_seq = 4 and mfc_module = "ADG"
               and mfc_logical = yes)
then
   assign
      schtype = 5
      use_ship_sched = yes.

{gplngn2a.i &file     = ""sch_mstr""
            &field    = ""sch_type""
            &code     = string(schtype)
            &mnemonic = sch_type_numonic
            &label    = sch_type_desc}

if not available lngd_det then do:
   /* Invalid Type */
   {pxmsg.i &MSGNUM=4211 &ERRORLEVEL=3}
end.
else
   display
      sch_type_desc
      schtype
   with frame a.

repeat with frame a:

   {rsgetord.i old}

   update
      schtype when (use_ship_sched)
      schrlse_1
      schrlse_2
   with frame a
   editing:

      global_schtype = schtype.
      {gpbrparm.i &browse=gplu539.p &parm=c-brparm3
                  &val="string(global_schtype)"}

      {mfnp05.i sch_mstr sch_tnlr
         "sch_type = schtype and sch_nbr = pod_nbr
           and sch_line = pod_line"
         sch_rlse_id
         "if frame-field = 'schrlse_1' then input schrlse_1
           else input schrlse_2"}

      if recno <> ? then do:
         if frame-field = 'schrlse_1' then
            display sch_rlse @ schrlse_1.
         else
            display sch_rlse @ schrlse_2.
      end.

   end.

   if (schrlse_1 = "" or schrlse_2 = "" ) then do:
      find last sch_mstr
         where sch_type = schtype
         and sch_nbr = pod_nbr
         and sch_line = pod_line
         use-index sch_cr_date
      no-lock no-error.

      if not available sch_mstr then do:
         {pxmsg.i &MSGNUM=6012 &ERRORLEVEL=3}
         if (schrlse_1 = "") then
            next-prompt schrlse_1.
         else
            next-prompt schrlse_2.
         undo, retry.
      end.

      if (schrlse_2 = "") then
         schrlse_2 = sch_rlse_id.

      if (schrlse_1 = "")
      then do:

         find prev sch_mstr
            where sch_type = schtype
            and sch_nbr = pod_nbr
            and sch_line = pod_line
            use-index sch_cr_date
         no-lock no-error.

         if available sch_mstr then
            schrlse_1 = sch_rlse_id.
         else do:
            {pxmsg.i &MSGNUM=6012 &ERRORLEVEL=3}
            next-prompt schrlse_2.
            undo, retry.
         end.

      end.

      display
         schrlse_1
         schrlse_2
      with frame a.

   end.

   find schmstr1 where schmstr1.sch_type = schtype
      and schmstr1.sch_nbr = pod_nbr
      and schmstr1.sch_line = pod_line
      and schmstr1.sch_rlse_id = schrlse_1
   no-lock no-error.

   if not available schmstr1 then do:
      {pxmsg.i &MSGNUM=6013 &ERRORLEVEL=3}
      next-prompt schrlse_1.
      undo, retry.
   end.

   find schmstr2 where schmstr2.sch_type = schtype
      and schmstr2.sch_nbr = pod_nbr
      and schmstr2.sch_line = pod_line
      and schmstr2.sch_rlse_id = schrlse_2
   no-lock no-error.

   if not available schmstr2 then do:
      {pxmsg.i &MSGNUM=6013 &ERRORLEVEL=3}
      next-prompt schrlse_2.
      undo, retry.
   end.

   {gplngn2a.i
      &file     = ""sch_mstr""
      &field    = ""sch_type""
      &code     = string(schtype)
      &mnemonic = sch_type_numonic
      &label    = sch_type_desc}

   if not available lngd_det
   then do:
      /* Invalid Type */
      {pxmsg.i &MSGNUM=4211 &ERRORLEVEL=3}
      if (c-application-mode = 'WEB') then
         return.
      else
         undo, retry.
   end. /* do */

   else do:
      assign
         sch_type_desc = lngd_translation.
      display
         sch_type_desc
      with frame a.
   end. /* else do */

   if can-find (first mfc_ctrl where
                      mfc_field = "enable_shipping_schedules"
                  and mfc_seq = 4 and mfc_module = "ADG"
                  and mfc_logical = yes)
   then do:

      if schtype = 4 then do:
         /* PRO/PLUS Supplier Schedules in use */
         {pxmsg.i &MSGNUM=4377 &ERRORLEVEL=2}
      end.

   end. /* do */

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "printer"
               &printWidth = 132
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}

   {mfphead.i}

   {gprun.i ""rsrp02a.p""}

   {mfrtrail.i}

end.
